<?php
/**
 * @ClassName: RackEnum
 * @Description: TODO
 * @author: gydtrade
 * @Date: 2025-09-29 11:48
 * @Version: V1.0.0
 */

namespace app\common\enum;

class RackEnum
{
    const ad_position_top = 1;
    const ad_position_left = 2;
    const ad_position_right = 3;

    const status_unused = -1;
    const status_used = 1;
    const status_expired = 2;

    /**
     * 架子规格
     * @param $level
     * @return string|string[]
     */
    public static function rackAllTypes($level)
    {
        $desc = [
            1 => '1#',
            2 => '2#',
            3 => '3#',
            4 => '4#',
            5 => '5#',
            6 => '6#',
            7 => '7#',
            8 => '8#',
            9 => '9#',
            10 => '10#',
            11 => '11#',
            12 => '12#',
        ];
        if ($level === true) {
            return $desc;
        }
        return $desc[$level] ?? $level;
    }

    public static function rackTypes($level)
    {
        $desc = [
            3 => '3#',
            6 => '6#',
            9 => '9#',
            12 => '12#',
        ];
        if ($level === true) {
            return $desc;
        }
        return $desc[$level] ?? $level;
    }

    /**
     * 能否投放广告
     * @param $level
     * @return string|string[]
     */
    public static function putAdTypes($level)
    {
        $desc = [
            0 => '不可以',
            1 => '可以',
        ];
        if ($level === true) {
            return $desc;
        }
        return $desc[$level] ?? $level;
    }

    /**
     * 广告投放位置
     * @param $level
     * @return string|string[]
     */
    public static function putAdPosition($level)
    {
        $desc = [
            self::ad_position_top => '顶部',
            self::ad_position_left => '左边',
            self::ad_position_right => '右边',
        ];
        if ($level === true) {
            return $desc;
        }
        return $desc[$level] ?? $level;
    }

    /**
     * 设备状态
     * @param $level
     * @return string|string[]
     */
    public static function statusText($level)
    {
        $desc = [
            self::status_unused => '未使用',
            self::status_used => '使用中',
            self::status_expired => '已到期',
        ];
        if ($level === true) {
            return $desc;
        }
        return $desc[$level] ?? $level;
    }

}